#pragma once
#include "DeviceBase.h"
#include <time.h>


namespace RobotPlant { namespace RobotProxy{
	using namespace std;
	using namespace boost::join;
	using namespace RobotPlant::Common;

	/*
	The AnalogSensor Device supports analog sensors that measure continuous information. 
	An example of this kind of a sensor is a light sensor which monitors the amount of light over time. 
	Analog sensors are often distinguished from digital sensors which use discrete (discontinuous) values to represent information for input. 
	Often though either approach can be used to provide similar types of information. 
	For example, film cameras are analog devices, while Web cameras are digital devices.
	*/
	class RP_ROBOTPROXY_API AnalogSensorDevice : public DeviceBase
	{
	public:
		/*
		Constructor
		*/
		AnalogSensorDevice(RobotInstance* pParent, joint::spawn_type e=0);

		/*
		Destructor
		*/
		~AnalogSensorDevice();

		/*
		The normalized input value, a value from 0 to 1 , calculated by dividing the RawMeasurement by the RawMeasurementRange.
		There is error if return value < 0.
		*/
		synch<double,void> GetNormalizedMeasurement;

		/*
		The raw input value from the sensor.
		There is error if return value < 0.
		*/
		synch<double,void> GetRawMeasurement;

		/*
		The upper bound of the raw measurement.
		There is error if return value < 0.
		*/
		synch<double,void> GetRawMeasurementRange;

		/*
		The timestamp of the sensor reading.
		There is error if return value < 0.
		*/
		synch<time_t,void> GetLastTimeStamp;

	protected:
		double Handler_GetNormalizedMeasurement(void_t);

		double Handler_GetRawMeasurement(void_t);

		double Handler_GetRawMeasurementRange(void_t);

		time_t Handler_GetLastTimeStamp(void_t);
	};
}}
